package org.transfer.service;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.transfer.dao.ImportLogDao;
import org.transfer.model.ImportLog;
import org.transfer.utils.UuidUtil;

@Transactional
@Service
public class ImportLogService {

	@Autowired
	private ImportLogDao importLogDao;

	public ImportLog get(ImportLog importLog) {
		return importLogDao.get(importLog);
	}

	@Transactional(readOnly = false)
	public void save(ImportLog importLog) {
		if (StringUtils.isNotBlank(importLog.getId())) {
			importLogDao.update(importLog);
		} else {
			importLog.setId(UuidUtil.getId());
			importLogDao.save(importLog);
		}
	}

	public List<ImportLog> findList(ImportLog importLog) {
		return importLogDao.findList(importLog);
	}

}
